package cn.wolfcode.trip.base.service.impl;


import cn.wolfcode.trip.base.domain.CommentReply;
import cn.wolfcode.trip.base.domain.TravelCommend;
import cn.wolfcode.trip.base.domain.TravelComment;
import cn.wolfcode.trip.base.mapper.CommentReplyMapper;
import cn.wolfcode.trip.base.mapper.GreatMapper;
import cn.wolfcode.trip.base.mapper.TravelCommentMapper;
import cn.wolfcode.trip.base.mapper.TravelContentMapper;
import cn.wolfcode.trip.base.service.ITravelCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class TravelCommentServiceImpl implements ITravelCommentService {
    @Autowired
    private TravelCommentMapper travelCommentMapper;
    @Autowired
    private CommentReplyMapper commentReplyMapper;
    @Override
    public void insert(TravelComment travelComment) {

        //发表评论的时间
        travelComment.setCreatetime(new Date());
        //更新时间
        travelComment.setUpdatetime(new Date());
        //状态,发表评论成功
        int state = TravelComment.COMMENT_SUCCESS;
        //保存操作
        travelCommentMapper.insert(travelComment);
    }

    /**
     * 保存评论回复的方法
     * @param commentReply
     */
    @Override
    public void insert(CommentReply commentReply) {
        //通过游记id查询该用户的id
        //发表评论回复的时间
        commentReply.setCreatetime(new Date());
        commentReplyMapper.insert(commentReply);
    }
}
